from rest_framework import serializers
from . models import Cate,Goods,Color,Version

class CateModelSerializer(serializers.ModelSerializer):

    class Meta:
        model = Cate  #指定要进行序列化的类
        fields = '__all__'  #指定要进行的字段__all__代表所有,也可以是元组



class GoodModelSerializer(serializers.ModelSerializer):

    class Meta:
        model = Goods  #指定要进行序列化的类
        fields = '__all__'  #指定要进行的字段__all__代表所有,也可以是元组

class ColorModelSerializer(serializers.ModelSerializer):

    class Meta:
        model = Color  #指定要进行序列化的类
        fields = ('color_name',)  #指定要进行的字段__all__代表所有,也可以是元组

class VersionModelSerializer(serializers.ModelSerializer):

    class Meta:
        model = Version  #指定要进行序列化的类
        fields = '__all__'  #指定要进行的字段__all__代表所有,也可以是元组